/*-----------------------------------------------------------------------------
 * WDGInitialize.cpp
 *-----------------------------------------------------------------------------
 * 
 *-----------------------------------------------------------------------------
 * All rights reserved by somma (fixbrain@gmail.com, unsorted@msn.com)
 *-----------------------------------------------------------------------------
 * - 23.01.2011 created
**---------------------------------------------------------------------------*/
#include "WDGInitialize.h"

#include "DriverUtil.h"


/**----------------------------------------------------------------------------
    \brief  WinDig initialize routine

    \param  
    \return         
    \code
    \endcode        
-----------------------------------------------------------------------------*/
NTSTATUS
WDGInitialize(
	IN PDRIVER_OBJECT DriverObject, 
	IN PUNICODE_STRING RegistryPath, 
	IN PDEVICE_OBJECT DeviceObject
	)
{
	ASSERT(NULL != DriverObject);
	ASSERT(NULL != RegistryPath);
	ASSERT(NULL != DeviceObject);
	if (NULL == DriverObject || NULL == RegistryPath || NULL == DeviceObject) 
	{
		return STATUS_INVALID_PARAMETER;
	}
	
	PDEVICE_EXTENSION DeviceExtension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;
	RtlZeroMemory(DeviceExtension, sizeof(DEVICE_EXTENSION));
	DeviceExtension->DeviceObject = DeviceObject;
	DeviceExtension->NumberOfProcessor = GetNumberOfProcessor();
	if (0 == DeviceExtension->NumberOfProcessor)
	{
		DBG_ERR
			"%s",
			"invalid cpu count=0"
		DBG_END
		return STATUS_FAILED_DRIVER_ENTRY;
	}

	DeviceExtension->Initialized = TRUE;	
	return STATUS_SUCCESS;
}